package com.bwie.bwedu.model.impl;

import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.bwie.bwedu.bean.response.BaseResponse;
import com.bwie.bwedu.model.IPasswordUpdModel;
import com.bwie.bwedu.volley.RequestAPI;

/**
 * Created by Administrator on 2016/7/23.
 */
public class PasswordModelImpl implements IPasswordUpdModel {
    @Override
    public void pwdUpd(String newPwd, final ChangedListener listener) {
        RequestAPI.pwdUpd(newPwd, new Response.Listener<BaseResponse>() {
            @Override
            public void onResponse(BaseResponse baseResponse) {
                if (true==baseResponse.ok){
                    listener.onChangedSuccess();
                }else{
                    listener.onChangedFail(baseResponse.msg);
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                listener.onChangedFail("请检查网络！");
            }
        });
    }
}
